package com.youmans.ossService.controller;

import com.youmans.commonutils.R;
import com.youmans.ossService.service.OssService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@Api(tags = "对象存储控制器")
@RequestMapping("/eduoss/fileoss")
public class OssController {
    @Autowired
    private OssService ossService;
    @PostMapping
    @ApiOperation("上传头像到服务器，网络中断？存储到本地服务器：阿里云服务器")
    public R policy(MultipartFile file) {

        String url = ossService.uploadFileAvatar(file);
        return R.ok().data("url",url);
    }
}
